package fr.cephb.swing;

import javax.swing.AbstractAction;
import javax.swing.Icon;

/** somehow deprecated because it only holds one object of type T use {@link ActionAdapter}  insted*/
public abstract class ObjectAction<T> extends AbstractAction
	{
	private static final long serialVersionUID = 1L;
	private static final String STORE="fr.cephb.swing.ObjectAction";
	public ObjectAction()
		{
		}

	public ObjectAction(T object)
		{
		this(object,String.valueOf(object));
		}
	
	public ObjectAction(T object,String name) {
		super(name);
		putValue(STORE, object);
		}

	public ObjectAction(T object,String name, Icon icon) {
		super(name, icon);
		putValue(STORE, object);
		}
	
	@SuppressWarnings("unchecked")
	public T getObject() {
		return (T)getValue(STORE);
		}
	
}
